package org.example.controller;


import org.example.domain.Demo;
import org.example.resp.CommonResp;
import org.example.service.DemoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * Demo控制器，处理Demo表相关接口
 */
@RestController
@RequestMapping("/demo")
public class DemoController {
    @Resource
    private DemoService demoService;

    /**
     * 查询Demo列表
     * @return 统一响应格式
     */
    @GetMapping("/list")
    public CommonResp<List<Demo>> list() {
        CommonResp<List<Demo>> resp = new CommonResp<>();
        List<Demo> list = demoService.list();
        resp.setContent(list);
        return resp;
    }
}